﻿using System;
using System.Collections.Generic;
using System.Text;
using KelonProud.Domain.Dtos;

namespace KelonProud.Extensions
{
    public static class SearchInputExtension
    {
        public static SearchInputDto ReplaceFilter(this SearchInputDto request, string oldName, string newName)
        {
            request.SearchList.Each(e =>
            {
                if (e.Name == oldName)
                {
                    e.Name = newName;
                }
            });

            return request;
        }

        public static SearchInputDto ReplaceOrder(this SearchInputDto request, string oldName, string newName)
        {
            if (request.Order.Name == oldName)
                request.Order.Name = newName;

            return request;
        }
    }
}
